import os
import subprocess
import platform

from SetupPython import PythonConfiguration as PythonRequirements
from SetupOpencv import OpencvConfiguration as OpencvRequirements
from SetupEigen3 import EigenConfiguration  as EigenRequirements

# Make sure everything we need for the setup is installed
PythonRequirements.Validate()

from SetupPremake import PremakeConfiguration as PremakeRequirements
os.chdir('./../') # Change from devtools/scripts directory to root
OpencvRequirements.Validate()
EigenRequirements.Validate()
premakeInstalled = PremakeRequirements.Validate()

if (premakeInstalled):
    if platform.system() == "Windows":
        print("\nRunning premake...")
        subprocess.call([os.path.abspath("./scripts/Win-GenProjects.bat"), "nopause"])

    print("\n安装完成!")
else:
    print("程序需要Premake用于生成sln工程文件.")